/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author ZhuangBing Yan
* @date 2022-09-07
**/
@Entity
@Data
@Table(name="gis_area_conf")
public class AreaConf implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "主键")
    private Long id;

    @Column(name = "`gis_area_name`")
    @ApiModelProperty(value = "项目地名字")
    private String gisAreaName;

    @Column(name = "`position`")
    @ApiModelProperty(value = "项目地坐标经纬度(GPS坐标系),如果为空字符串，表示尚未计算gps数据，如果为null，表示无法找到对应gps地点")
    private String position;

    @Column(name = "`type`")
    @ApiModelProperty(value = "1:苏再生/绿和工厂 2:苏再生的转运中心(应用点) 3:苏再生的拆迁地(排放点) 4:其它; 5:无锡的应用点; 6:无锡的排放点; 7:常州的应用点; 8:常州的排放点 ")
    private Integer type;

    @Column(name = "`position_gcj02`")
    @ApiModelProperty(value = "火星坐标系经纬度(高德地图默认坐标系)")
    private String positionGcj02;

    @Column(name = "`line`")
    @ApiModelProperty(value = "从公司出发去转运中心/从拆迁地出发去公司 的导航折线经纬度坐标(GPS坐标系)")
    private String line;

    @Column(name = "`city`")
    @ApiModelProperty(value = "所在城市名 例如：苏州市")
    private String city;

    @Column(name = "`district`")
    @ApiModelProperty(value = "所在辖区 例如：相城区")
    private String district;

    @Transient
    @ApiModelProperty(value = "所在省 例如：江苏省")
    private String province;

    @Transient
    @ApiModelProperty(value = "城市编码 例如：0512")
    private String cityCode;

    @Transient
    @ApiModelProperty(value = "区域编码 例如：320507")
    private String districtCode;

    public void copy(AreaConf source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
